package edu.ncsu.csc.itrust.http;

import com.meterware.httpunit.WebConversation;
import com.meterware.httpunit.WebResponse;
import com.meterware.httpunit.WebForm;

/**
 * Bug #3 in HW2P2
 * @author stbowen & pjfinega
 *
 */
public class SpecialtySearchTest extends iTrustHTTPTest {

	 /**
     * Clear and setup database for independent testing
     */
    protected void setUp() throws Exception{
        super.setUp();
        gen.clearAllTables();
        gen.standardData();
    }
    
    /**
     * Tests Bug#3 for HW2P2
     * @throws Exception
     */
    public void testSearchBySpecialty() throws Exception {
    	
    	setUp();
    	
    	//Fill-in search
    	WebConversation wc = login("2", "pw");
    	WebResponse wr = wc.getCurrentPage();
    	wr = wr.getLinkWith("My Providers").click();
    	WebForm wf = wr.getForms()[1];
    	wf.setParameter("filter_specialty", "surgeon");
    	wf.getSubmitButtons()[0].click();    	
    	
    	//Test results
    	wr = wc.getCurrentPage();
    	assertFalse( wr.getText().contains("Stormcrow") );    	
    }
	
}
